<?php require_once WEB_ROOT_FOLDER."views/header.php";?>
<?php if(isset($_SESSION['access_level']) && ($_SESSION['access_level'] = 9)){ ?>
<fieldset>
    <legend>Zarządzaj statusami, dodawaj, usuwaj oraz edytuj</legend>
    <h4>Zarzadzaj statusami</h4>
    <?php if(isset($data['page']['content']['0']) && is_array($data['page']['content']['0'])){
        ?>
    <form method="post" action="<?php echo SITE_ROOT;?>statusy-kont/aktualizuj.html">
        <?php if(isset($data['page']['content']['0']['0'])){?>
        <input type="hidden" name="old_status_name" value="<?php echo $data['page']['content']['0']['0'];?>">
        <?php } ?>
    <?php
    }
    else {
    ?>
        <form method="post" action="<?php echo SITE_ROOT;?>statusy-kont/wstaw.html">
    <?php } ?>
            <?php if(isset($data['page']['csrf_token'])){?>
            <input type="hidden" name="csrf_token" value="<?php echo $data['page']['csrf_token'];?>">
            <?php } ?>
            <label class="col_12 column" for="status_name">
                <?php if(isset($data['page']['content']['0']['0'])){?>
                Edytuj status
                <?php } else { ?>
                Dodaj status
                <?php } ?>
                <br><span class="right">Podaj nowy status konta dla użytkownika w systemie.</span>
            </label><br>
            <input class="col_12 column" name="status_name" id="status_name" required
                   <?php if(isset($data['page']['content']['0']['0'])){?>
                   value="<?php echo $data['page']['content']['0']['0'];?>"
                   <?php } else { ?>
                   placeholder="Wpisz nazwę statusu ..."
                   <?php } ?>
                   ><br>
            <label class="col_12 column" for="status_description">
                <?php if(isset($data['page']['content']['0']['1'])){ ?>
                Edytuj opis statusu
                <?php } else { ?>
                Dodaj opis statusu
                <?php } ?>
                <br><span class="right">Wpisz krótki opis statusu.</span>
            </label><br>
            <textarea class="col_12 column" rows="5" name="status_description" required <?php if(!isset($data['page']['content']['0']['1'])){ ?>placeholder="Wpisz krótki opis statusu. Opis nie powinien przekraczać 256 znaków"<?php } ?>>
                <?php if(isset($data['page']['content']['0']['1'])){?>
                <?php echo $data['page']['content']['0']['1'];?>
                <?php } ?>
            </textarea>
            <br><br>
            <input type="submit" name="submit" value="<?php if(isset($data['page']['content']['0']) && is_array($data['page']['content']['0'])){?>Edytuj status<?php } else { ?>Dodaj nowy status<?php } ?>">
            <br><br>
    </form>
        <?php if(isset($data['page']['content']['0']['0'])){ ?>
        <ul class="button-bar"><li><a href="<?php echo SITE_ROOT;?>/statusy-kont/usun/<?php echo $data['page']['content']['0']['0'];?>" title="Usun status: <?php echo $data['page']['content']['0']['0'];?>"><i class="icon-ambulance"></i>Usuń status</a></li>
        <?php } ?>
</fieldset>            
<?php } ?>
<?php require_once WEB_ROOT_FOLDER.'views/footer.php'; ?>